package com.gh.cloud.uaa.service;

import com.alibaba.nacos.common.utils.UuidUtils;
import com.gh.cloud.commons.core.model.LoginUser;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import java.util.Collections;

/**
 * @author: guohao
 * @date: 2021-02-07 17:27
 **/
@Service
public class LocalUserDetailService implements UserDetailsService {


    @Override
    public LoginUser loadUserByUsername(String userName) throws UsernameNotFoundException {
        LoginUser user= new LoginUser();
        user.setUserId(UuidUtils.generateUuid());
        user.setUserName("guohao");
        user.setPassword("$2a$10$hSxA4FRhwQ4iEnyTUVdUSudf2xHF39noEtX8eJJWfg/1GZaWKNVf2");
        user.setNickName("guohao");
        user.setRuleList(Collections.singletonList("AppUser"));
        return user;
    }
}
